package com.fkjslee.DAO;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * @author fkjslee
 * @date 2018/4/18 at 17:06
 * Copyright (c) 2018 fkjslee. All rights reserved.
 */

@Entity
public class AccountTable implements Serializable{

    private static final long serialVersionUID = 6177417450707400228L;

    @Id
    private String account;

    private String password;

    private String nickname;

    private UserType userType;

    private Integer maxTaskSize;

    private Integer remainTaskSize;

    private Long needTime;


    public AccountTable() {}

    public AccountTable(String account, String password, String nickname, UserType userType) {
        this.account = account;
        this.password = password;
        this.nickname = nickname;
        this.userType = userType;
        if (userType.equals(UserType.L1)) {
            this.maxTaskSize = this.remainTaskSize = 100;
            this.needTime = 10 * 1000L;
        }
        else if (userType.equals(UserType.L2)) {
            this.maxTaskSize = this.remainTaskSize = 200;
            this.needTime = 20 * 1000L;
        }
        else if (userType.equals(UserType.L3)) {
            this.maxTaskSize = this.remainTaskSize = 300;
            this.needTime = 30 * 1000L;
        }
    }

    public Long getNeedTime() {
        return needTime;
    }

    public void setNeedTime(Long needTime) {
        this.needTime = needTime;
    }

    public Integer getMaxTaskSize() {
        return maxTaskSize;
    }

    public void setMaxTaskSize(Integer maxTaskSize) {
        this.maxTaskSize = maxTaskSize;
    }

    public Integer getRemainTaskSize() {
        return remainTaskSize;
    }

    public void setRemainTaskSize(Integer remainTaskSize) {
        this.remainTaskSize = remainTaskSize;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public UserType getUserType() {
        return userType;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }

    public enum UserType {
        L1, L2, L3
    }
}
